//删除有序数组中的重复项
const removeDuplicates = function(nums) {
        let i = 0;
        for (let j = 1; j < nums.length; j++) {
            if (nums[j] !== nums[i]) {
                i++;
                nums[i] = nums[j];
            }
        }
        return i + 1;
    };

    console.log(removeDuplicates([0,0,1,1,1,2,2,3,3,4]))


const removeDuplicates_1 = function(nums) {
    const numSet = new Set(nums);
    return numSet.size
};

    console.log(removeDuplicates_1([0,0,1,1,1,2,2,3,3,4]))
